/*
 * AircraftCarrierConfiguration.cpp
 *
 *  Created on: Jun 21, 2009
 *      Author: computer
 */

#include "AircraftCarrierConfiguration.h"

AircraftCarrierConfiguration::AircraftCarrierConfiguration(int _numberConfiguration)
: numberConfiguration(_numberConfiguration){ }

AircraftCarrierConfiguration::~AircraftCarrierConfiguration() { }

AircraftCarrierConfiguration* AircraftCarrierConfiguration::createAircraftCarrierConfiguration(int _type) throw (InvalidBoatConfiguration) {
	switch (_type) {
	case 1:
		return new AircraftCarrierConfiguration1();
		break;
	case 2:
		return new AircraftCarrierConfiguration2();
		break;
	case 3:
		return new AircraftCarrierConfiguration3();
		break;
	case 4:
		return new AircraftCarrierConfiguration4();
		break;
	default:
		throw InvalidBoatConfiguration(4);
	}
}

int AircraftCarrierConfiguration::getNumberConfiguration() const {
	return numberConfiguration;
}

AircraftCarrierConfiguration1::AircraftCarrierConfiguration1() : AircraftCarrierConfiguration(1){ }

AircraftCarrierConfiguration1::~AircraftCarrierConfiguration1() { }

RectangularBoatShape* AircraftCarrierConfiguration1::getHullShape(const string& _name, const Point<int>& _origin, char _filledChar) const {
	return new RectangularBoatShape(_name, _origin, Dimension<int>(4,1), _filledChar);
}

RectangularBoatShape* AircraftCarrierConfiguration1::getDeckShape(const string& _name, const Point<int>& _origin, char _filledChar) const {
	return new RectangularBoatShape(_name, _origin+ Point<int>(0,1), Dimension<int>(2,1), _filledChar);
}

AircraftCarrierConfiguration2::AircraftCarrierConfiguration2() : AircraftCarrierConfiguration(2) { }

AircraftCarrierConfiguration2::~AircraftCarrierConfiguration2() { }

RectangularBoatShape* AircraftCarrierConfiguration2::getHullShape(const string& _name, const Point<int>& _origin, char _filledChar) const {
	return new RectangularBoatShape(_name, _origin, Dimension<int>(1,4), _filledChar);
}

RectangularBoatShape* AircraftCarrierConfiguration2::getDeckShape(const string& _name, const Point<int>& _origin, char _filledChar) const {
	return new RectangularBoatShape(_name, _origin+ Point<int>(1,0), Dimension<int>(1,2), _filledChar);
}

AircraftCarrierConfiguration3::AircraftCarrierConfiguration3() : AircraftCarrierConfiguration(3){ }

AircraftCarrierConfiguration3::~AircraftCarrierConfiguration3() { }

RectangularBoatShape* AircraftCarrierConfiguration3::getHullShape(const string& _name, const Point<int>& _origin, char _filledChar) const {
	return new RectangularBoatShape(_name, _origin+ Point<int>(0,1), Dimension<int>(4,1), _filledChar);
}

RectangularBoatShape* AircraftCarrierConfiguration3::getDeckShape(const string& _name, const Point<int>& _origin, char _filledChar) const {
	return new RectangularBoatShape(_name, _origin, Dimension<int>(2,1), _filledChar);
}

AircraftCarrierConfiguration4::AircraftCarrierConfiguration4() : AircraftCarrierConfiguration(4) { }

AircraftCarrierConfiguration4::~AircraftCarrierConfiguration4() { }

RectangularBoatShape* AircraftCarrierConfiguration4::getHullShape(const string& _name, const Point<int>& _origin, char _filledChar) const {
	return new RectangularBoatShape(_name, _origin+ Point<int>(1,0), Dimension<int>(1,4), _filledChar);
}

RectangularBoatShape* AircraftCarrierConfiguration4::getDeckShape(const string& _name, const Point<int>& _origin, char _filledChar) const {
	return new RectangularBoatShape(_name, _origin, Dimension<int>(1,2), _filledChar);
}
